package com.dhcc.sds.standard.controller;


import com.baomidou.mybatisplus.plugins.Page;
import com.dhcc.core.framework.base.controller.BaseController;
import com.dhcc.core.framework.base.warpper.EmptyWarpper;
import com.dhcc.core.framework.exception.BizException;
import com.dhcc.core.framework.exception.BizExceptionEnum;
import com.dhcc.core.framework.result.R;
import com.dhcc.core.framework.result.page.PageFactory;
import com.dhcc.core.framework.util.CommonUtil;
import com.dhcc.sds.standard.entity.SdsStandMatchLogEntity;
import com.dhcc.sds.standard.entity.SdsStdDicMatchLogEntity;
import com.dhcc.sds.standard.service.ISdsStandMatchLogService;
import com.dhcc.sds.standard.service.ISdsStdDicMatchLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;


/**
 * 标准化对照日志记录表
 * 
 * @ClassName: StMatchLogController
 * @Description: TODO
 * @author zhangdc
 * @date 2021-05-08 16:01:23
 */
@Controller
@RequestMapping("${sys.backendPath}/sds/sdsstddicmatchlog")
public class SdsStdDicMatchLogController extends BaseController {

	private String PREFIX = "/backend/sds/sdsstddicmatchlog/";

	@Autowired
	private ISdsStdDicMatchLogService stdDicMatchLogService;
	

    /**
     * 跳转到标准化对照日志记录表列表首页
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "sdsstddicmatchlog.html";
    }
	
    /**
     * 跳转到新增标准化对照日志记录表
     */
//    @RequestMapping("/to_add")
//    public String toAdd() {
//        return PREFIX + "sdsstddicmatchlog_add.html";
//    }
	
	/**
     * 跳转到修改标准化对照日志记录表
     */
//    @RequestMapping("/to_update/{sdsStandMatchLogId}")
//    public String toUpdate(@PathVariable Long sdsStandMatchLogId, Model model) {
//        SdsStandMatchLogEntity sdsStandMatchLogEntity = this.standMatchLogService.selectById(sdsStandMatchLogId);
//        model.addAttribute("sdsStandMatchLog",sdsStandMatchLogEntity);
//        return PREFIX + "sdsstandmatchlog_edit.html";
//    }

    /**
     * 获取标准化对照日志记录表列表
     */
	@SuppressWarnings("unchecked")
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(@RequestParam Map<String, Object> params) {
		Page<SdsStdDicMatchLogEntity> page = new PageFactory<SdsStdDicMatchLogEntity>().defaultPage();
        List<SdsStdDicMatchLogEntity> result = this.stdDicMatchLogService.page(page,params);
        page.setRecords((List<SdsStdDicMatchLogEntity>) new EmptyWarpper(result).warp());
        return R.packForBT(page);
    }

    /**
     * 新增标准化对照日志记录表
     */
//    @RequestMapping(value = "/add")
//    @ResponseBody
//    public Object add(SdsStandMatchLogEntity sdsStandMatchLogEntity) {
//        if (CommonUtil.isOneEmpty(sdsStandMatchLogEntity)) {
//            throw new BizException(BizExceptionEnum.REQUEST_NULL);
//        }
//        sdsStandMatchLogEntity.insert();
//        return R.ok();
//    }

    /**
     * 删除标准化对照日志记录表
     */
//    @RequestMapping(value = "/delete")
//    @ResponseBody
//    public Object delete(@RequestParam Long sdsStandMatchLogId) {
//
//        this.standMatchLogService.deleteById(sdsStandMatchLogId);
//
//        return R.ok();
//    }

    /**
     * 修改标准化对照日志记录表
     */
//    @RequestMapping(value = "/update")
//    @ResponseBody
//    public Object update(SdsStandMatchLogEntity sdsStandMatchLogEntity) {
//        if (CommonUtil.isOneEmpty(sdsStandMatchLogEntity)) {
//            throw new BizException(BizExceptionEnum.REQUEST_NULL);
//        }
//        SdsStandMatchLogEntity old = this.standMatchLogService.selectById(sdsStandMatchLogEntity.getId());
//
//        old.setMatchType(sdsStandMatchLogEntity.getMatchType());
//        old.setDicId(sdsStandMatchLogEntity.getDicId());
//        old.setDicsubId(sdsStandMatchLogEntity.getDicsubId());
//        old.setOrdmastId(sdsStandMatchLogEntity.getOrdmastId());
//        old.setExamdicId(sdsStandMatchLogEntity.getExamdicId());
//        old.setLaborderId(sdsStandMatchLogEntity.getLaborderId());
//        old.setLabitemId(sdsStandMatchLogEntity.getLabitemId());
//        old.setOperType(sdsStandMatchLogEntity.getOperType());
//        old.setOperTime(sdsStandMatchLogEntity.getOperTime());
//        old.setOperUser(sdsStandMatchLogEntity.getOperUser());
//        old.setOperContent(sdsStandMatchLogEntity.getOperContent());
//        old.updateAllColumnById();
//        return R.ok();
//    }
	
}
